package com.dfrz.common;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author 29877
 */

@Getter
@AllArgsConstructor
public enum ResultEnum {
    SUCCESS(210,"请求成功"),
    ERROR(410,"请求失败"),
    ABNORMAL(520,"服务器异常！"),
    TOKEN_EX(521,"token异常"),
    NO_LOGIN(411,"您还没有登录！");
    //自行添加自定义相应信息
    private final Integer code;
    private final String msg;

    public static ResultEnum getResultCode(Integer code){
        for(ResultEnum value : ResultEnum.values()){
            if(code.equals(value.getCode())){
                return value;
            }
        }
        return ResultEnum.ERROR;
    }
}
